#!/usr/bin/perl

# bl-obmenu-generator - schema.pl file
# Created by martix (based on obmenu-generator schema.pl by Trizen)
# For BunsenLabs Hydrogen, icon theme Faenza: June 2017
# Modified for BunsenLabs Helium, icon theme Paper: June 2018
# (C) martix GNU GPLv3 2017-2018

=for comment

    item:      add an item inside the menu               {item => ["command", "label", "icon"]},
    cat:       add a category inside the menu            {cat => ["name", "label", "icon"]},
    sep:       horizontal line separator                 {sep => undef}, {sep => "label"},
    pipe:      a pipe menu entry                         {pipe => ["command", "label", "icon"]},
    raw:       any valid Openbox XML string              {raw => q(xml string)},
    beg: 	   begin of a category        		     	 {beg => ["name", "icon"]},
    end:   	   end of a category         	    	     {end => undef},
    obgenmenu: generic menu settings              		 {obgenmenu => ["label", "icon"]},
    exit:      default "Exit" action                     {exit => ["label", "icon"]},

=cut

# NOTE:
#    * Keys and values are case sensitive. Keep all keys lowercase.
#    * ICON can be either a direct path to an icon or a valid icon name.
#    * Category names are case insensitive. (X-XFCE and x_xfce are equivalent)

require "$ENV{HOME}/.config/bl-obmenu-generator/config.pl";

# Text editor
my $editor = $CONFIG->{editor};



## Menu Structure
our $SCHEMA = [

#   	  Item		Command		Label		Icon 
        {item => ['gmrun', 'Run Program', 'system-run']},

	
	### Separator ---------------------------------------------------------       
	{sep => undef},
 
#   	   Item			Command				Label			Icon        
        {item => ['x-terminal-emulator', 'Terminal', 	 'terminal']},
        {item => ['x-www-browser',	 	 'Web Browser',  'web-browser']},
        {item => ['bl-file-manager', 	 'File Manager', 'file-manager']},
        {item => ['bl-text-editor', 	 'Text Editor',  'text-editor']},
        {item => ['bl-media-player', 	 'Media Player', 'multimedia-player']},

	
	### Separator ---------------------------------------------------------        
	{sep => undef},
    
    # Menu categories
        
#	 Category   Name			Label					Icon 
    {cat => ['utility',     'Accessories', 		'applications-utilities']},
  # {cat => ['development', 'Development', 		'applications-development']},
  # {cat => ['education',   'Education',   		'applications-science']},
    {cat => ['game',        'Games',       		'applications-games']},
    {cat => ['graphics',    'Graphics',    		'applications-graphics']},
    {cat => ['audiovideo',  'Multimedia',  		'applications-multimedia']},
    {cat => ['network',     'Network',     		'applications-internet']},
    {cat => ['office',      'Office',      		'applications-office']},
  # {cat => ['other',       'Other',       		'applications-other']},
    {cat => ['settings',    'Settings',    		'applications-accessories']},
    {cat => ['system',      'System Tools',		'applications-system']},
  # {cat => ['qt',          'QT Applications',  'qtcreator']},
  # {cat => ['gtk',         'GTK Applications', 'gtk-properties']},
  # {cat => ['x_xfce',      'XFCE Applications','applications-other']},
  # {cat => ['gnome',       'GNOME Applications','gnome-applications']},
  # {cat => ['consoleonly', 'CLI Applications', 'applications-utilities']},

# How to add a custom category:

    #             LABEL          ICON
    #{beg => ['My category',  'cat-icon']},
    #             ... some items ...    {item => ["command", "label", "icon"]},
    #{end => undef},

# LXDE Menu entry
	#{pipe => ['openbox-menu lxde-applications.menu', 'LXDE', 'lxde_badge-symbolic']},
	
	
	### Separator ---------------------------------------------------------
	{sep => undef},
    
    ## Pipe menu categories for #BĹ Places and Recent Files
    
    {pipe => ['bl-places-pipemenu', 'Places', 'gtk-directory']},
    {pipe => ['bl-recent-files-pipemenu', 'Recent Files', 'document-open-recent']},
    
    
    ### Separator ---------------------------------------------------------
   # {sep       => undef},

# Generic menu settings    
   # {obgenmenu => ['Generic menu settings', 'configuration_section',]},
    
    
    ### Separator ---------------------------------------------------------
    {sep       => undef},
 
    {beg => ["Preferences", "preferences-other"]},
		
		{beg => ["Openbox", "preferences-system-windows"]},
						
		  # {item => ['bl-text-editor ~/.config/openbox/menu.xml', 'Edit menu.xml', 'text-editor']},
							
		    {item => ['bl-text-editor ~/.config/bl-obmenu-generator/schema.pl', 'Edit schema.pl', 'text-editor']},
					
			{item => ['bl-text-editor ~/.config/openbox/rc.xml', 'Edit rc.xml', 'package_editors']},
			
		  # {item => ['bl-text-editor ~/.config/bl-obmenu-generator/config.pl', 'Edit config.pl', 'text-editor']},
			
		  	#{item => ['bl-menu-switch', 'Menu Switch', 'bl-menu-switch']},
					
			{item => ['bl-text-editor ~/.config/openbox/autostart', 'Edit autostart', 'hexedit']},  
							
			{item => ['obmenu', 'GUI Menu Editor', 'gconf-editor']},
							
			{item => ['obconf', 'GUI Config Tool', 'gtk-preferences']},
							
			{item => ['yad --button="OK":0 --center --window-icon=distributor-logo-bunsenlabs --text-info --title="How to Edit the Menu" --filename=/usr/share/bunsen/docs/helpfile-menu.txt --width=900 --height=700 --fontname=Monospace', 'How to Edit Menu', 'dialog-information']},
							
			{item => ['openbox --reconfigure', 'Reconfigure', 'user-desktop']},
							
			{item => ['openbox --restart', 'Restart', 'system-restart']},
					
		{end => undef},
    
			{pipe => ['bl-compositor', 'Compositor', 'window-new']},			
					
			{pipe => ['bl-conky-pipemenu', 'Conky', 'utilities-system-monitor']},
					
			{pipe => ['bl-tint2-pipemenu', 'Tint2', 'tint2']},
    
		{item => ['lxappearance', 'Appearance', 'preferences-theme']},
		
		{item => ['bl-text-editor ~/.config/fontconfig/fonts.conf', 'Font configuration', 'preferences-desktop-font']},
		
		{item => ['bl-obthemes', 'BLOB Themes Manager', 'distributor-logo-bunsenlabs']},
		
		{item => ['nitrogen', 'Wallpaper', 'nitrogen']},
		
		{item => ['xfce4-notifyd-config', 'Notifications', 'xfce4-notifyd']},
		
		{item => ['xfce4-power-manager-settings', 'Power Management', 'cs-power']},
		
		
		{beg => ["dmenu", "app-launcher"]},
    
			{item => ['bl-text-editor ~/.config/dmenu/dmenu-bind.sh', 'Edit Start-Up Script', 'text-editor']},
						
			{item => ['x-terminal-emulator -T "dmenu man page" -e man dmenu', 'Help: man dmenu', 'stock_dialog-question']},
    
		{end => undef},
		
		
		{beg => ["gmrun", "system-run"]},
    
			{item => ['bl-text-editor ~/.gmrunrc', 'Edit Config File', 'text-editor']},
						
			{item => ['x-terminal-emulator -T "gmrun man page" -e man gmrun', 'Help: man gmrun', 'stock_dialog-question']},
    
		{end => undef},
					
	
		{beg => ["Display", "display"]},
    
			{item => ['arandr', 'Display Settings', 'cs-display']},
						
			{item => ['x-terminal-emulator -T "xrandr man page" -e man xrandr', 'Help: man xrandr', 'stock_dialog-question']},
						
		{end => undef},
		
    {end => undef},
  
    {beg => ["System", "system"]},
    
		{pipe => ['bl-printing-pipemenu', 'Printers', 'printer']},
			
		{item => ['pkexec synaptic', 'Synaptic Package Manager', 'synaptic']},
				
		{item => ['pkexec bl-file-manager', 'File Manager as Root', 'file-manager']},
				
		{item => ['pkexec bl-text-editor', 'Text Editor as Root', 'text-editor']},
				
		{item => ['pkexec bl-text-editor /etc/lightdm/lightdm-gtk-greeter.conf /etc/lightdm/lightdm.conf', 'Login Settings', 'avatar-default']},
				
		{item => ['pkexec gparted', 'GParted', 'gparted']},
				
		{item => ['pkexec galternatives', 'Edit Debian Alternatives', 'galternatives']},
				
		{item => ['yad --button="OK":0 --center --window-icon=distributor-logo-bunsenlabs --text-info --title="About Bunsen Alternatives" --filename="/usr/share/bunsen/docs/helpfile-bl-alternatives.txt" --width=900 --height=700 --fontname=Monospace', 'About Bunsen Alternatives', 'distributor-logo-bunsenlabs']},
    
    {end => undef},
    
    {pipe => ['bl-help-pipemenu', 'Help', 'system-help']},
   
	
	### Separator ---------------------------------------------------------
    {sep => undef},
	
	{pipe => ['bl-kb-pipemenu', 'Display Keybinds', 'preferences-desktop-keyboard-shortcuts']},
 	
 	
 	### Separator ---------------------------------------------------------
 	{sep => undef},
	
	{item => ['bl-lock', 'Lock Screen', 'system-lock-screen']},
	
	{item => ['bl-exit', 'Exit', 'xfce-system-exit']},]
